﻿using LiteBlog.Components.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Web;

namespace LiteBlog.Controllers.Helpers
{
    class MessageHelper
    {
        public static string GetMessage(string controller, MethodResult result)
        {
            string className = controller.Replace("Controller", "Messages");
            var classType = Type.GetType("LiteBlog.Controllers.Resources." + className);
            var propertyInfo = classType.GetProperty(result.ToString(), BindingFlags.Static | BindingFlags.NonPublic);
            return (string)propertyInfo.GetValue(null, null);
        }
    }
}